{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>订单编号</th>\n",
       "      <th>菜名</th>\n",
       "      <th>菜的数量</th>\n",
       "      <th>菜的单价</th>\n",
       "      <th>菜的下单时间</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>417</td>\n",
       "      <td>蒜蓉生蚝</td>\n",
       "      <td>1</td>\n",
       "      <td>49</td>\n",
       "      <td>2016-08-01 11:05:36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>417</td>\n",
       "      <td>蒙古烤羊腿</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>2016-08-01 11:07:07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>417</td>\n",
       "      <td>大蒜苋菜</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>2016-08-01 11:07:40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>417</td>\n",
       "      <td>芝麻烤紫菜</td>\n",
       "      <td>1</td>\n",
       "      <td>25</td>\n",
       "      <td>2016-08-01 11:11:11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>417</td>\n",
       "      <td>蒜香包</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>2016-08-01 11:11:30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>301</td>\n",
       "      <td>白斩鸡</td>\n",
       "      <td>1</td>\n",
       "      <td>88</td>\n",
       "      <td>2016-08-01 11:15:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>301</td>\n",
       "      <td>香烤牛排\\r\\n</td>\n",
       "      <td>1</td>\n",
       "      <td>55</td>\n",
       "      <td>2016-08-01 11:19:12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>301</td>\n",
       "      <td>干锅田鸡</td>\n",
       "      <td>1</td>\n",
       "      <td>88</td>\n",
       "      <td>2016-08-01 11:22:21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>301</td>\n",
       "      <td>桂圆枸杞鸽子汤</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>2016-08-01 11:22:53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>301</td>\n",
       "      <td>番茄有机花菜</td>\n",
       "      <td>1</td>\n",
       "      <td>32</td>\n",
       "      <td>2016-08-01 11:23:56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>301</td>\n",
       "      <td>白饭/大碗</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>2016-08-01 11:31:15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>413</td>\n",
       "      <td>芝士烩波士顿龙虾</td>\n",
       "      <td>1</td>\n",
       "      <td>175</td>\n",
       "      <td>2016-08-01 12:42:52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>413</td>\n",
       "      <td>葱姜炒蟹</td>\n",
       "      <td>1</td>\n",
       "      <td>109</td>\n",
       "      <td>2016-08-01 12:43:21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>413</td>\n",
       "      <td>皮蛋瘦肉粥</td>\n",
       "      <td>1</td>\n",
       "      <td>16</td>\n",
       "      <td>2016-08-01 12:43:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>413</td>\n",
       "      <td>爆炒鳝碌</td>\n",
       "      <td>1</td>\n",
       "      <td>55</td>\n",
       "      <td>2016-08-01 12:44:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>413</td>\n",
       "      <td>干锅田鸡</td>\n",
       "      <td>1</td>\n",
       "      <td>88</td>\n",
       "      <td>2016-08-01 12:44:12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>413</td>\n",
       "      <td>番茄甘蓝</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>2016-08-01 12:45:09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>413</td>\n",
       "      <td>重庆特色油烧兔</td>\n",
       "      <td>1</td>\n",
       "      <td>69</td>\n",
       "      <td>2016-08-01 12:45:24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>413</td>\n",
       "      <td>番茄炖秋葵</td>\n",
       "      <td>1</td>\n",
       "      <td>35</td>\n",
       "      <td>2016-08-01 12:46:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>413</td>\n",
       "      <td>长城窖酿解百纳红酒干红葡萄酒</td>\n",
       "      <td>1</td>\n",
       "      <td>35</td>\n",
       "      <td>2016-08-01 12:48:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>413</td>\n",
       "      <td>紫薯面包卷</td>\n",
       "      <td>1</td>\n",
       "      <td>20</td>\n",
       "      <td>2016-08-01 12:49:27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>413</td>\n",
       "      <td>桂圆肉红豆八宝饭</td>\n",
       "      <td>1</td>\n",
       "      <td>39</td>\n",
       "      <td>2016-08-01 12:50:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>415</td>\n",
       "      <td>避风塘炒蟹</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>2016-08-01 12:51:38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>413</td>\n",
       "      <td>番茄炖牛腩\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>1</td>\n",
       "      <td>35</td>\n",
       "      <td>2016-08-01 12:51:46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>413</td>\n",
       "      <td>香菇鹌鹑蛋</td>\n",
       "      <td>1</td>\n",
       "      <td>39</td>\n",
       "      <td>2016-08-01 12:52:18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>415</td>\n",
       "      <td>花蛤蒸蛋</td>\n",
       "      <td>1</td>\n",
       "      <td>37</td>\n",
       "      <td>2016-08-01 12:52:37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>413</td>\n",
       "      <td>啤酒鸭</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>2016-08-01 12:53:39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>413</td>\n",
       "      <td>焖猪手</td>\n",
       "      <td>1</td>\n",
       "      <td>58</td>\n",
       "      <td>2016-08-01 12:54:30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>392</td>\n",
       "      <td>豌豆薯仔猪骨汤</td>\n",
       "      <td>1</td>\n",
       "      <td>39</td>\n",
       "      <td>2016-08-01 12:58:44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>415</td>\n",
       "      <td>小炒羊腰\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>1</td>\n",
       "      <td>36</td>\n",
       "      <td>2016-08-01 12:59:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2749</th>\n",
       "      <td>732</td>\n",
       "      <td>水煮鱼</td>\n",
       "      <td>1</td>\n",
       "      <td>65</td>\n",
       "      <td>2016-08-10 20:19:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2750</th>\n",
       "      <td>732</td>\n",
       "      <td>美妙绝伦之白莲花</td>\n",
       "      <td>1</td>\n",
       "      <td>29</td>\n",
       "      <td>2016-08-10 20:19:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2751</th>\n",
       "      <td>616</td>\n",
       "      <td>麻辣小龙虾</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "      <td>2016-08-10 20:37:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2752</th>\n",
       "      <td>616</td>\n",
       "      <td>土豆西红柿汤面</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>2016-08-10 20:39:37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2753</th>\n",
       "      <td>716</td>\n",
       "      <td>麻辣小龙虾</td>\n",
       "      <td>1</td>\n",
       "      <td>99</td>\n",
       "      <td>2016-08-10 20:41:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2754</th>\n",
       "      <td>716</td>\n",
       "      <td>辣炒鱿鱼</td>\n",
       "      <td>1</td>\n",
       "      <td>58</td>\n",
       "      <td>2016-08-10 20:41:29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2755</th>\n",
       "      <td>716</td>\n",
       "      <td>谷稻小庄</td>\n",
       "      <td>1</td>\n",
       "      <td>38</td>\n",
       "      <td>2016-08-10 20:46:41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2756</th>\n",
       "      <td>716</td>\n",
       "      <td>凉拌菠菜</td>\n",
       "      <td>1</td>\n",
       "      <td>27</td>\n",
       "      <td>2016-08-10 20:47:14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2757</th>\n",
       "      <td>716</td>\n",
       "      <td>蒙古烤羊腿\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>2016-08-10 20:47:17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2758</th>\n",
       "      <td>716</td>\n",
       "      <td>水煮鱼</td>\n",
       "      <td>1</td>\n",
       "      <td>65</td>\n",
       "      <td>2016-08-10 20:47:36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2759</th>\n",
       "      <td>616</td>\n",
       "      <td>酸辣汤面</td>\n",
       "      <td>1</td>\n",
       "      <td>16</td>\n",
       "      <td>2016-08-10 20:48:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2760</th>\n",
       "      <td>616</td>\n",
       "      <td>张裕葡萄酒张裕赤霞珠干红\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>1</td>\n",
       "      <td>32</td>\n",
       "      <td>2016-08-10 20:49:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2761</th>\n",
       "      <td>716</td>\n",
       "      <td>白胡椒胡萝卜羊肉汤</td>\n",
       "      <td>1</td>\n",
       "      <td>35</td>\n",
       "      <td>2016-08-10 20:50:11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2762</th>\n",
       "      <td>716</td>\n",
       "      <td>红酒炖羊肉</td>\n",
       "      <td>1</td>\n",
       "      <td>108</td>\n",
       "      <td>2016-08-10 20:50:12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2763</th>\n",
       "      <td>716</td>\n",
       "      <td>干锅田鸡</td>\n",
       "      <td>1</td>\n",
       "      <td>88</td>\n",
       "      <td>2016-08-10 20:51:37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2764</th>\n",
       "      <td>716</td>\n",
       "      <td>南瓜枸杞小饼干</td>\n",
       "      <td>1</td>\n",
       "      <td>19</td>\n",
       "      <td>2016-08-10 20:51:42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2765</th>\n",
       "      <td>716</td>\n",
       "      <td>香烤牛排\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>1</td>\n",
       "      <td>55</td>\n",
       "      <td>2016-08-10 20:52:09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2766</th>\n",
       "      <td>716</td>\n",
       "      <td>白饭/大碗</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>2016-08-10 20:52:12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2767</th>\n",
       "      <td>716</td>\n",
       "      <td>芝麻烤紫菜</td>\n",
       "      <td>1</td>\n",
       "      <td>25</td>\n",
       "      <td>2016-08-10 20:53:09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2768</th>\n",
       "      <td>716</td>\n",
       "      <td>杭椒鸡珍</td>\n",
       "      <td>1</td>\n",
       "      <td>58</td>\n",
       "      <td>2016-08-10 20:53:26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2769</th>\n",
       "      <td>716</td>\n",
       "      <td>泡椒凤爪\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>1</td>\n",
       "      <td>58</td>\n",
       "      <td>2016-08-10 20:56:10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2770</th>\n",
       "      <td>716</td>\n",
       "      <td>糖醋蕃茄溜青花</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>2016-08-10 20:57:11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2771</th>\n",
       "      <td>774</td>\n",
       "      <td>清蒸海鱼</td>\n",
       "      <td>1</td>\n",
       "      <td>78</td>\n",
       "      <td>2016-08-10 21:50:35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2772</th>\n",
       "      <td>774</td>\n",
       "      <td>水煮鱼</td>\n",
       "      <td>1</td>\n",
       "      <td>65</td>\n",
       "      <td>2016-08-10 21:53:17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2773</th>\n",
       "      <td>774</td>\n",
       "      <td>独家薄荷鲜虾牛肉卷\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>1</td>\n",
       "      <td>45</td>\n",
       "      <td>2016-08-10 21:55:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>774</td>\n",
       "      <td>白饭/大碗</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>2016-08-10 21:56:24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2775</th>\n",
       "      <td>774</td>\n",
       "      <td>牛尾汤</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>2016-08-10 21:56:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2776</th>\n",
       "      <td>774</td>\n",
       "      <td>意文柠檬汁</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>2016-08-10 22:01:52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2777</th>\n",
       "      <td>774</td>\n",
       "      <td>金玉良缘</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>2016-08-10 22:03:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2778</th>\n",
       "      <td>774</td>\n",
       "      <td>酸辣藕丁</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>2016-08-10 22:04:30</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2779 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      订单编号                        菜名  菜的数量  菜的单价              菜的下单时间\n",
       "0      417                      蒜蓉生蚝     1    49 2016-08-01 11:05:36\n",
       "1      417                     蒙古烤羊腿     1    48 2016-08-01 11:07:07\n",
       "2      417                      大蒜苋菜     1    30 2016-08-01 11:07:40\n",
       "3      417                     芝麻烤紫菜     1    25 2016-08-01 11:11:11\n",
       "4      417                       蒜香包     1    13 2016-08-01 11:11:30\n",
       "5      301                       白斩鸡     1    88 2016-08-01 11:15:57\n",
       "6      301                  香烤牛排\\r\\n     1    55 2016-08-01 11:19:12\n",
       "7      301                      干锅田鸡     1    88 2016-08-01 11:22:21\n",
       "8      301                   桂圆枸杞鸽子汤     1    48 2016-08-01 11:22:53\n",
       "9      301                    番茄有机花菜     1    32 2016-08-01 11:23:56\n",
       "10     301                     白饭/大碗     1    10 2016-08-01 11:31:15\n",
       "11     413                  芝士烩波士顿龙虾     1   175 2016-08-01 12:42:52\n",
       "12     413                      葱姜炒蟹     1   109 2016-08-01 12:43:21\n",
       "13     413                     皮蛋瘦肉粥     1    16 2016-08-01 12:43:34\n",
       "14     413                      爆炒鳝碌     1    55 2016-08-01 12:44:08\n",
       "15     413                      干锅田鸡     1    88 2016-08-01 12:44:12\n",
       "16     413                      番茄甘蓝     1    33 2016-08-01 12:45:09\n",
       "17     413                   重庆特色油烧兔     1    69 2016-08-01 12:45:24\n",
       "18     413                     番茄炖秋葵     1    35 2016-08-01 12:46:26\n",
       "19     413            长城窖酿解百纳红酒干红葡萄酒     1    35 2016-08-01 12:48:48\n",
       "20     413                     紫薯面包卷     1    20 2016-08-01 12:49:27\n",
       "21     413                  桂圆肉红豆八宝饭     1    39 2016-08-01 12:50:03\n",
       "22     415                     避风塘炒蟹     1    48 2016-08-01 12:51:38\n",
       "23     413         番茄炖牛腩\\r\\n\\r\\n\\r\\n     1    35 2016-08-01 12:51:46\n",
       "24     413                     香菇鹌鹑蛋     1    39 2016-08-01 12:52:18\n",
       "25     415                      花蛤蒸蛋     1    37 2016-08-01 12:52:37\n",
       "26     413                       啤酒鸭     1    48 2016-08-01 12:53:39\n",
       "27     413                       焖猪手     1    58 2016-08-01 12:54:30\n",
       "28     392                   豌豆薯仔猪骨汤     1    39 2016-08-01 12:58:44\n",
       "29     415          小炒羊腰\\r\\n\\r\\n\\r\\n     1    36 2016-08-01 12:59:03\n",
       "...    ...                       ...   ...   ...                 ...\n",
       "2749   732                       水煮鱼     1    65 2016-08-10 20:19:03\n",
       "2750   732                  美妙绝伦之白莲花     1    29 2016-08-10 20:19:22\n",
       "2751   616                     麻辣小龙虾     1    99 2016-08-10 20:37:48\n",
       "2752   616                   土豆西红柿汤面     1    13 2016-08-10 20:39:37\n",
       "2753   716                     麻辣小龙虾     1    99 2016-08-10 20:41:10\n",
       "2754   716                      辣炒鱿鱼     1    58 2016-08-10 20:41:29\n",
       "2755   716                     谷稻小庄      1    38 2016-08-10 20:46:41\n",
       "2756   716                      凉拌菠菜     1    27 2016-08-10 20:47:14\n",
       "2757   716         蒙古烤羊腿\\r\\n\\r\\n\\r\\n     1    48 2016-08-10 20:47:17\n",
       "2758   716                       水煮鱼     1    65 2016-08-10 20:47:36\n",
       "2759   616                      酸辣汤面     1    16 2016-08-10 20:48:31\n",
       "2760   616  张裕葡萄酒张裕赤霞珠干红\\r\\n\\r\\n\\r\\n     1    32 2016-08-10 20:49:20\n",
       "2761   716                 白胡椒胡萝卜羊肉汤     1    35 2016-08-10 20:50:11\n",
       "2762   716                     红酒炖羊肉     1   108 2016-08-10 20:50:12\n",
       "2763   716                      干锅田鸡     1    88 2016-08-10 20:51:37\n",
       "2764   716                   南瓜枸杞小饼干     1    19 2016-08-10 20:51:42\n",
       "2765   716          香烤牛排\\r\\n\\r\\n\\r\\n     1    55 2016-08-10 20:52:09\n",
       "2766   716                     白饭/大碗     1    10 2016-08-10 20:52:12\n",
       "2767   716                     芝麻烤紫菜     1    25 2016-08-10 20:53:09\n",
       "2768   716                      杭椒鸡珍     1    58 2016-08-10 20:53:26\n",
       "2769   716          泡椒凤爪\\r\\n\\r\\n\\r\\n     1    58 2016-08-10 20:56:10\n",
       "2770   716                   糖醋蕃茄溜青花     1    33 2016-08-10 20:57:11\n",
       "2771   774                      清蒸海鱼     1    78 2016-08-10 21:50:35\n",
       "2772   774                       水煮鱼     1    65 2016-08-10 21:53:17\n",
       "2773   774     独家薄荷鲜虾牛肉卷\\r\\n\\r\\n\\r\\n     1    45 2016-08-10 21:55:58\n",
       "2774   774                     白饭/大碗     1    10 2016-08-10 21:56:24\n",
       "2775   774                       牛尾汤     1    40 2016-08-10 21:56:48\n",
       "2776   774                    意文柠檬汁      1    13 2016-08-10 22:01:52\n",
       "2777   774                      金玉良缘     1    30 2016-08-10 22:03:58\n",
       "2778   774                      酸辣藕丁     1    33 2016-08-10 22:04:30\n",
       "\n",
       "[2779 rows x 5 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "data = pd.read_excel(\n",
    "            r'D:pandas库/dataset/新明细表.xlsx',  #相对路径。\n",
    ")\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 案例1：统计每个订单的点菜总数量"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.指定分组变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<pandas.core.groupby.groupby.DataFrameGroupBy object at 0x0000000007D11198>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.groupby(by='订单编号')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.指定需要聚合的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<pandas.core.groupby.groupby.SeriesGroupBy object at 0x0000000007D11BA8>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.groupby(by='订单编号')['菜的数量']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3指定具体的聚合函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "订单编号\n",
       "137      9\n",
       "165     21\n",
       "166      7\n",
       "171     10\n",
       "177      4\n",
       "193      8\n",
       "201      5\n",
       "203      7\n",
       "239      4\n",
       "242     11\n",
       "260      9\n",
       "266      8\n",
       "281     21\n",
       "283      8\n",
       "285      5\n",
       "294      5\n",
       "301      6\n",
       "302     19\n",
       "306      9\n",
       "310      4\n",
       "311     12\n",
       "312      7\n",
       "313     13\n",
       "314     23\n",
       "317     13\n",
       "320      7\n",
       "333      5\n",
       "338      6\n",
       "342      5\n",
       "344      4\n",
       "        ..\n",
       "1193    13\n",
       "1201    12\n",
       "1203    16\n",
       "1208    12\n",
       "1211    14\n",
       "1224    11\n",
       "1227     9\n",
       "1250     5\n",
       "1251    11\n",
       "1258     9\n",
       "1259     4\n",
       "1263     7\n",
       "1264    10\n",
       "1266    16\n",
       "1267     8\n",
       "1268    11\n",
       "1274     7\n",
       "1278     6\n",
       "1282    15\n",
       "1288    17\n",
       "1290    15\n",
       "1293     5\n",
       "1298     9\n",
       "1302    22\n",
       "1303     9\n",
       "1309    15\n",
       "1314    12\n",
       "1317    18\n",
       "1319     9\n",
       "1323    15\n",
       "Name: 菜的数量, Length: 278, dtype: int64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.groupby(by='订单编号')['菜的数量'].sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 查询某个订单的点菜总数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "查看订单417的点菜总数： 5\n"
     ]
    }
   ],
   "source": [
    "result = data.groupby(by='订单编号')['菜的数量'].sum()\n",
    "print('查看订单417的点菜总数：',result[417])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 如何计算订单每个订单的总花费"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "订单编号\n",
       "137      197\n",
       "165     1147\n",
       "166      260\n",
       "171      299\n",
       "177      137\n",
       "193      238\n",
       "201      119\n",
       "203      238\n",
       "239      182\n",
       "242      224\n",
       "260      302\n",
       "266      335\n",
       "281      394\n",
       "283      250\n",
       "285      147\n",
       "294      155\n",
       "301      321\n",
       "302      634\n",
       "306      218\n",
       "310      227\n",
       "311      402\n",
       "312      286\n",
       "313      279\n",
       "314      694\n",
       "317      523\n",
       "320      457\n",
       "333      159\n",
       "338      201\n",
       "342      109\n",
       "344      134\n",
       "        ... \n",
       "1193     373\n",
       "1201     374\n",
       "1203     617\n",
       "1208     430\n",
       "1211     682\n",
       "1224     347\n",
       "1227     196\n",
       "1250     149\n",
       "1251     292\n",
       "1258     240\n",
       "1259     158\n",
       "1263     193\n",
       "1264     500\n",
       "1266     625\n",
       "1267     269\n",
       "1268     405\n",
       "1274     264\n",
       "1278     185\n",
       "1282     602\n",
       "1288     766\n",
       "1290     656\n",
       "1293     222\n",
       "1298     256\n",
       "1302     706\n",
       "1303     124\n",
       "1309     445\n",
       "1314     508\n",
       "1317    1210\n",
       "1319     610\n",
       "1323     764\n",
       "Name: 菜的总价, Length: 278, dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['菜的总价'] = data['菜的数量']*data['菜的单价']\n",
    "data.groupby(by='订单编号')['菜的总价'].sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 案例2：统计超市不同小时段的商品销量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>发票编号</th>\n",
       "      <th>分店</th>\n",
       "      <th>城市</th>\n",
       "      <th>顾客类型</th>\n",
       "      <th>性别</th>\n",
       "      <th>商品类别</th>\n",
       "      <th>商品单价（美元）</th>\n",
       "      <th>购买数量（件）</th>\n",
       "      <th>购买日期</th>\n",
       "      <th>时间</th>\n",
       "      <th>支付方式</th>\n",
       "      <th>支付费用（美元）</th>\n",
       "      <th>收益（美元）</th>\n",
       "      <th>购物体验评分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>426-39-2418</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>61.41</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-14</td>\n",
       "      <td>10:02:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>429.87</td>\n",
       "      <td>21.4935</td>\n",
       "      <td>9.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>527-09-6272</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>28.45</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-21</td>\n",
       "      <td>10:17:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>142.25</td>\n",
       "      <td>7.1125</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>761-49-0439</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>12.10</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-01-19</td>\n",
       "      <td>10:17:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>96.80</td>\n",
       "      <td>4.8400</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>421-95-9805</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>28.96</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-07</td>\n",
       "      <td>10:18:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>28.96</td>\n",
       "      <td>1.4480</td>\n",
       "      <td>6.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>811-03-8790</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>45.48</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-01</td>\n",
       "      <td>10:22:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>454.80</td>\n",
       "      <td>22.7400</td>\n",
       "      <td>4.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>745-71-3520</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>25.22</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-04</td>\n",
       "      <td>10:23:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>176.54</td>\n",
       "      <td>8.8270</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>250-81-7186</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>99.69</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-27</td>\n",
       "      <td>10:23:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>99.69</td>\n",
       "      <td>4.9845</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>399-69-4630</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>22.21</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-07</td>\n",
       "      <td>10:23:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>133.26</td>\n",
       "      <td>6.6630</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>365-64-0515</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>46.95</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-02-12</td>\n",
       "      <td>10:25:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>234.75</td>\n",
       "      <td>11.7375</td>\n",
       "      <td>7.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>213-32-1216</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>66.06</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-23</td>\n",
       "      <td>10:28:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>396.36</td>\n",
       "      <td>19.8180</td>\n",
       "      <td>7.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>226-31-3081</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>15.28</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-08</td>\n",
       "      <td>10:29:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>76.40</td>\n",
       "      <td>3.8200</td>\n",
       "      <td>9.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>734-91-1155</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>45.71</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-03-26</td>\n",
       "      <td>10:34:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>137.13</td>\n",
       "      <td>6.8565</td>\n",
       "      <td>7.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>438-23-1242</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>75.88</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>10:38:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>531.16</td>\n",
       "      <td>16.5580</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>512-98-1403</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>26.48</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-03-21</td>\n",
       "      <td>10:40:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>79.44</td>\n",
       "      <td>3.9720</td>\n",
       "      <td>4.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>366-93-0948</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>66.35</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-01-31</td>\n",
       "      <td>10:46:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>66.35</td>\n",
       "      <td>3.3175</td>\n",
       "      <td>9.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>466-61-5506</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>90.70</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-02-26</td>\n",
       "      <td>10:52:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>544.20</td>\n",
       "      <td>27.2100</td>\n",
       "      <td>5.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>778-34-2523</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>48.62</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>10:57:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>388.96</td>\n",
       "      <td>19.4480</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>226-34-0034</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>13.78</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-01-10</td>\n",
       "      <td>11:10:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>55.12</td>\n",
       "      <td>2.7560</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>831-81-6575</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>75.59</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-23</td>\n",
       "      <td>11:12:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>680.31</td>\n",
       "      <td>14.0155</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>636-48-8204</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>34.56</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-02-17</td>\n",
       "      <td>11:15:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>172.80</td>\n",
       "      <td>8.6400</td>\n",
       "      <td>9.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>233-34-0817</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>98.84</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-15</td>\n",
       "      <td>11:21:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>98.84</td>\n",
       "      <td>4.9420</td>\n",
       "      <td>8.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>300-71-4605</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>86.04</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-02-25</td>\n",
       "      <td>11:24:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>430.20</td>\n",
       "      <td>21.5100</td>\n",
       "      <td>4.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>575-67-1508</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>38.60</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-01-29</td>\n",
       "      <td>11:26:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>38.60</td>\n",
       "      <td>1.9300</td>\n",
       "      <td>6.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>551-21-3069</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>23.07</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-01</td>\n",
       "      <td>11:27:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>207.63</td>\n",
       "      <td>10.3815</td>\n",
       "      <td>4.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>831-07-6050</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>32.71</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-19</td>\n",
       "      <td>11:30:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>163.55</td>\n",
       "      <td>8.1775</td>\n",
       "      <td>9.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>804-38-3935</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>93.78</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-01-30</td>\n",
       "      <td>11:32:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>281.34</td>\n",
       "      <td>14.0670</td>\n",
       "      <td>5.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>886-77-9084</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>71.89</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-02-19</td>\n",
       "      <td>11:33:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>575.12</td>\n",
       "      <td>18.7560</td>\n",
       "      <td>5.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>603-07-0961</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>74.79</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-01-10</td>\n",
       "      <td>11:34:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>373.95</td>\n",
       "      <td>18.6975</td>\n",
       "      <td>4.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>652-49-6720</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>60.95</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-18</td>\n",
       "      <td>11:40:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>60.95</td>\n",
       "      <td>3.0475</td>\n",
       "      <td>5.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>189-40-5216</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>96.37</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-09</td>\n",
       "      <td>11:40:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>674.59</td>\n",
       "      <td>23.7295</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>970</th>\n",
       "      <td>743-88-1662</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>95.49</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-22</td>\n",
       "      <td>18:17:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>668.43</td>\n",
       "      <td>33.4215</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>971</th>\n",
       "      <td>560-30-5617</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>24.77</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-24</td>\n",
       "      <td>18:27:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>123.85</td>\n",
       "      <td>6.1925</td>\n",
       "      <td>8.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>972</th>\n",
       "      <td>554-53-3790</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>37.02</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-22</td>\n",
       "      <td>18:33:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>222.12</td>\n",
       "      <td>11.1060</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>973</th>\n",
       "      <td>695-51-0018</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>34.84</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-02-10</td>\n",
       "      <td>18:36:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>139.36</td>\n",
       "      <td>6.9680</td>\n",
       "      <td>7.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>974</th>\n",
       "      <td>618-34-8551</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>93.18</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-01-16</td>\n",
       "      <td>18:41:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>186.36</td>\n",
       "      <td>9.3180</td>\n",
       "      <td>8.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>975</th>\n",
       "      <td>696-90-2548</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>25.84</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-03-10</td>\n",
       "      <td>18:55:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>77.52</td>\n",
       "      <td>3.8760</td>\n",
       "      <td>6.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>976</th>\n",
       "      <td>751-69-0068</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>99.24</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-03-19</td>\n",
       "      <td>19:09:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>893.16</td>\n",
       "      <td>44.6580</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>977</th>\n",
       "      <td>123-35-4896</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>46.66</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-17</td>\n",
       "      <td>19:11:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>419.94</td>\n",
       "      <td>20.9970</td>\n",
       "      <td>5.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>978</th>\n",
       "      <td>129-29-8530</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>62.62</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-10</td>\n",
       "      <td>19:15:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>313.10</td>\n",
       "      <td>15.6550</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>979</th>\n",
       "      <td>423-57-2993</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>93.39</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-27</td>\n",
       "      <td>19:18:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>560.34</td>\n",
       "      <td>28.0170</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>980</th>\n",
       "      <td>510-79-0415</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>23.08</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>19:20:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>138.48</td>\n",
       "      <td>6.9240</td>\n",
       "      <td>4.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>981</th>\n",
       "      <td>154-74-7179</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>54.45</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-26</td>\n",
       "      <td>19:24:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>54.45</td>\n",
       "      <td>2.7225</td>\n",
       "      <td>7.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>982</th>\n",
       "      <td>575-30-8091</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>72.50</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-03-16</td>\n",
       "      <td>19:25:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>580.00</td>\n",
       "      <td>29.0000</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>983</th>\n",
       "      <td>825-94-5922</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>25.31</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-03-02</td>\n",
       "      <td>19:26:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>50.62</td>\n",
       "      <td>2.5310</td>\n",
       "      <td>7.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>984</th>\n",
       "      <td>752-23-3760</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>64.08</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-19</td>\n",
       "      <td>19:29:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>448.56</td>\n",
       "      <td>22.4280</td>\n",
       "      <td>7.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>985</th>\n",
       "      <td>394-30-3170</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>88.43</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-03-22</td>\n",
       "      <td>19:35:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>707.44</td>\n",
       "      <td>35.3720</td>\n",
       "      <td>4.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>986</th>\n",
       "      <td>827-77-7633</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>98.09</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-17</td>\n",
       "      <td>19:41:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>882.81</td>\n",
       "      <td>144.1405</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>987</th>\n",
       "      <td>423-80-0988</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>76.40</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-01-30</td>\n",
       "      <td>19:42:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>152.80</td>\n",
       "      <td>7.6400</td>\n",
       "      <td>6.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>988</th>\n",
       "      <td>883-17-4236</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>14.39</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-03-02</td>\n",
       "      <td>19:44:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>28.78</td>\n",
       "      <td>1.4390</td>\n",
       "      <td>7.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>989</th>\n",
       "      <td>493-65-6248</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>36.98</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-01-01</td>\n",
       "      <td>19:48:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>369.80</td>\n",
       "      <td>18.4900</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>990</th>\n",
       "      <td>503-07-0930</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>58.39</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-23</td>\n",
       "      <td>19:49:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>408.73</td>\n",
       "      <td>20.4365</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>991</th>\n",
       "      <td>327-40-9673</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>72.60</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-13</td>\n",
       "      <td>19:51:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>435.60</td>\n",
       "      <td>21.7800</td>\n",
       "      <td>6.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>992</th>\n",
       "      <td>880-46-5796</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>76.92</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-17</td>\n",
       "      <td>19:53:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>769.20</td>\n",
       "      <td>38.4600</td>\n",
       "      <td>5.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>993</th>\n",
       "      <td>276-54-0879</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>97.74</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-03-12</td>\n",
       "      <td>19:53:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>390.96</td>\n",
       "      <td>119.5480</td>\n",
       "      <td>6.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>994</th>\n",
       "      <td>225-32-0908</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>44.86</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-01-26</td>\n",
       "      <td>19:54:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>448.60</td>\n",
       "      <td>22.4300</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>828-61-5674</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>44.02</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-20</td>\n",
       "      <td>19:57:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>440.20</td>\n",
       "      <td>122.0100</td>\n",
       "      <td>9.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>670-71-7306</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>44.63</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-02</td>\n",
       "      <td>20:08:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>267.78</td>\n",
       "      <td>13.3890</td>\n",
       "      <td>5.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>630-74-5166</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>62.13</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-22</td>\n",
       "      <td>20:19:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>372.78</td>\n",
       "      <td>18.6390</td>\n",
       "      <td>7.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>182-52-7000</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>27.04</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-01-01</td>\n",
       "      <td>20:26:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>108.16</td>\n",
       "      <td>5.4080</td>\n",
       "      <td>6.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>802-70-5316</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>92.13</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-06</td>\n",
       "      <td>20:34:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>552.78</td>\n",
       "      <td>127.6390</td>\n",
       "      <td>8.3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            发票编号   分店   城市  顾客类型 性别   商品类别  商品单价（美元）  购买数量（件）       购买日期  \\\n",
       "0    426-39-2418  分店C  城市C  普通顾客  男   电子配件     61.41        7 2020-01-14   \n",
       "1    527-09-6272  分店A  城市A    会员  女   电子配件     28.45        5 2020-03-21   \n",
       "2    761-49-0439  分店B  城市B    会员  女   电子配件     12.10        8 2020-01-19   \n",
       "3    421-95-9805  分店A  城市A  普通顾客  女   电子配件     28.96        1 2020-02-07   \n",
       "4    811-03-8790  分店A  城市A  普通顾客  女   电子配件     45.48       10 2020-03-01   \n",
       "5    745-71-3520  分店A  城市A    会员  女   电子配件     25.22        7 2020-02-04   \n",
       "6    250-81-7186  分店C  城市C  普通顾客  女   电子配件     99.69        1 2020-02-27   \n",
       "7    399-69-4630  分店C  城市C  普通顾客  男   电子配件     22.21        6 2020-03-07   \n",
       "8    365-64-0515  分店A  城市A  普通顾客  女   电子配件     46.95        5 2020-02-12   \n",
       "9    213-32-1216  分店A  城市A  普通顾客  女   电子配件     66.06        6 2020-01-23   \n",
       "10   226-31-3081  分店C  城市C  普通顾客  女   电子配件     15.28        5 2020-03-08   \n",
       "11   734-91-1155  分店B  城市B  普通顾客  女   电子配件     45.71        3 2020-03-26   \n",
       "12   438-23-1242  分店B  城市B  普通顾客  男   电子配件     75.88        7 2020-01-24   \n",
       "13   512-98-1403  分店A  城市A    会员  女   电子配件     26.48        3 2020-03-21   \n",
       "14   366-93-0948  分店A  城市A    会员  男   电子配件     66.35        1 2020-01-31   \n",
       "15   466-61-5506  分店B  城市B    会员  女   电子配件     90.70        6 2020-02-26   \n",
       "16   778-34-2523  分店A  城市A    会员  女   电子配件     48.62        8 2020-01-24   \n",
       "17   226-34-0034  分店B  城市B  普通顾客  女   电子配件     13.78        4 2020-01-10   \n",
       "18   831-81-6575  分店B  城市B    会员  女   电子配件     75.59        9 2020-02-23   \n",
       "19   636-48-8204  分店A  城市A  普通顾客  男   电子配件     34.56        5 2020-02-17   \n",
       "20   233-34-0817  分店C  城市C    会员  女   电子配件     98.84        1 2020-02-15   \n",
       "21   300-71-4605  分店C  城市C    会员  男   电子配件     86.04        5 2020-02-25   \n",
       "22   575-67-1508  分店A  城市A  普通顾客  男   电子配件     38.60        1 2020-01-29   \n",
       "23   551-21-3069  分店C  城市C  普通顾客  女   电子配件     23.07        9 2020-02-01   \n",
       "24   831-07-6050  分店A  城市A  普通顾客  男   电子配件     32.71        5 2020-03-19   \n",
       "25   804-38-3935  分店A  城市A    会员  男   电子配件     93.78        3 2020-01-30   \n",
       "26   886-77-9084  分店C  城市C  普通顾客  男   电子配件     71.89        8 2020-02-19   \n",
       "27   603-07-0961  分店C  城市C    会员  男   电子配件     74.79        5 2020-01-10   \n",
       "28   652-49-6720  分店C  城市C    会员  女   电子配件     60.95        1 2020-02-18   \n",
       "29   189-40-5216  分店C  城市C  普通顾客  男   电子配件     96.37        7 2020-01-09   \n",
       "..           ...  ...  ...   ... ..    ...       ...      ...        ...   \n",
       "970  743-88-1662  分店C  城市C  普通顾客  男  运动与旅行     95.49        7 2020-02-22   \n",
       "971  560-30-5617  分店B  城市B  普通顾客  女  运动与旅行     24.77        5 2020-03-24   \n",
       "972  554-53-3790  分店B  城市B  普通顾客  男  运动与旅行     37.02        6 2020-03-22   \n",
       "973  695-51-0018  分店B  城市B  普通顾客  女  运动与旅行     34.84        4 2020-02-10   \n",
       "974  618-34-8551  分店A  城市A  普通顾客  女  运动与旅行     93.18        2 2020-01-16   \n",
       "975  696-90-2548  分店A  城市A  普通顾客  男  运动与旅行     25.84        3 2020-03-10   \n",
       "976  751-69-0068  分店C  城市C  普通顾客  男  运动与旅行     99.24        9 2020-03-19   \n",
       "977  123-35-4896  分店C  城市C  普通顾客  女  运动与旅行     46.66        9 2020-02-17   \n",
       "978  129-29-8530  分店A  城市A    会员  男  运动与旅行     62.62        5 2020-03-10   \n",
       "979  423-57-2993  分店B  城市B  普通顾客  男  运动与旅行     93.39        6 2020-03-27   \n",
       "980  510-79-0415  分店B  城市B    会员  女  运动与旅行     23.08        6 2020-01-24   \n",
       "981  154-74-7179  分店B  城市B  普通顾客  男  运动与旅行     54.45        1 2020-02-26   \n",
       "982  575-30-8091  分店A  城市A  普通顾客  男  运动与旅行     72.50        8 2020-03-16   \n",
       "983  825-94-5922  分店B  城市B  普通顾客  男  运动与旅行     25.31        2 2020-03-02   \n",
       "984  752-23-3760  分店B  城市B    会员  女  运动与旅行     64.08        7 2020-02-19   \n",
       "985  394-30-3170  分店B  城市B    会员  女  运动与旅行     88.43        8 2020-03-22   \n",
       "986  827-77-7633  分店A  城市A  普通顾客  男  运动与旅行     98.09        9 2020-02-17   \n",
       "987  423-80-0988  分店C  城市C  普通顾客  男  运动与旅行     76.40        2 2020-01-30   \n",
       "988  883-17-4236  分店C  城市C  普通顾客  女  运动与旅行     14.39        2 2020-03-02   \n",
       "989  493-65-6248  分店C  城市C    会员  女  运动与旅行     36.98       10 2020-01-01   \n",
       "990  503-07-0930  分店C  城市C    会员  男  运动与旅行     58.39        7 2020-02-23   \n",
       "991  327-40-9673  分店B  城市B    会员  男  运动与旅行     72.60        6 2020-01-13   \n",
       "992  880-46-5796  分店A  城市A    会员  男  运动与旅行     76.92       10 2020-03-17   \n",
       "993  276-54-0879  分店B  城市B  普通顾客  男  运动与旅行     97.74        4 2020-03-12   \n",
       "994  225-32-0908  分店C  城市C  普通顾客  女  运动与旅行     44.86       10 2020-01-26   \n",
       "995  828-61-5674  分店A  城市A    会员  男  运动与旅行     44.02       10 2020-03-20   \n",
       "996  670-71-7306  分店B  城市B  普通顾客  男  运动与旅行     44.63        6 2020-01-02   \n",
       "997  630-74-5166  分店A  城市A  普通顾客  男  运动与旅行     62.13        6 2020-03-22   \n",
       "998  182-52-7000  分店A  城市A    会员  女  运动与旅行     27.04        4 2020-01-01   \n",
       "999  802-70-5316  分店A  城市A    会员  女  运动与旅行     92.13        6 2020-03-06   \n",
       "\n",
       "           时间  支付方式  支付费用（美元）    收益（美元）  购物体验评分  \n",
       "0    10:02:00    现金    429.87   21.4935     9.8  \n",
       "1    10:17:00   信用卡    142.25    7.1125     9.1  \n",
       "2    10:17:00  电子钱包     96.80    4.8400     8.6  \n",
       "3    10:18:00   信用卡     28.96    1.4480     6.2  \n",
       "4    10:22:00   信用卡    454.80   22.7400     4.8  \n",
       "5    10:23:00    现金    176.54    8.8270     8.2  \n",
       "6    10:23:00   信用卡     99.69    4.9845     8.0  \n",
       "7    10:23:00   信用卡    133.26    6.6630     8.6  \n",
       "8    10:25:00  电子钱包    234.75   11.7375     7.1  \n",
       "9    10:28:00    现金    396.36   19.8180     7.3  \n",
       "10   10:29:00    现金     76.40    3.8200     9.6  \n",
       "11   10:34:00   信用卡    137.13    6.8565     7.7  \n",
       "12   10:38:00  电子钱包    531.16   16.5580     8.9  \n",
       "13   10:40:00  电子钱包     79.44    3.9720     4.7  \n",
       "14   10:46:00   信用卡     66.35    3.3175     9.7  \n",
       "15   10:52:00    现金    544.20   27.2100     5.3  \n",
       "16   10:57:00    现金    388.96   19.4480     5.0  \n",
       "17   11:10:00  电子钱包     55.12    2.7560     9.0  \n",
       "18   11:12:00    现金    680.31   14.0155     8.0  \n",
       "19   11:15:00  电子钱包    172.80    8.6400     9.9  \n",
       "20   11:21:00    现金     98.84    4.9420     8.4  \n",
       "21   11:24:00  电子钱包    430.20   21.5100     4.8  \n",
       "22   11:26:00  电子钱包     38.60    1.9300     6.7  \n",
       "23   11:27:00    现金    207.63   10.3815     4.9  \n",
       "24   11:30:00   信用卡    163.55    8.1775     9.9  \n",
       "25   11:32:00   信用卡    281.34   14.0670     5.9  \n",
       "26   11:33:00  电子钱包    575.12   18.7560     5.5  \n",
       "27   11:34:00    现金    373.95   18.6975     4.9  \n",
       "28   11:40:00  电子钱包     60.95    3.0475     5.9  \n",
       "29   11:40:00    现金    674.59   23.7295     6.0  \n",
       "..        ...   ...       ...       ...     ...  \n",
       "970  18:17:00  电子钱包    668.43   33.4215     8.7  \n",
       "971  18:27:00    现金    123.85    6.1925     8.5  \n",
       "972  18:33:00    现金    222.12   11.1060     4.5  \n",
       "973  18:36:00    现金    139.36    6.9680     7.4  \n",
       "974  18:41:00   信用卡    186.36    9.3180     8.5  \n",
       "975  18:55:00  电子钱包     77.52    3.8760     6.6  \n",
       "976  19:09:00  电子钱包    893.16   44.6580     9.0  \n",
       "977  19:11:00  电子钱包    419.94   20.9970     5.3  \n",
       "978  19:15:00  电子钱包    313.10   15.6550     7.0  \n",
       "979  19:18:00  电子钱包    560.34   28.0170    10.0  \n",
       "980  19:20:00  电子钱包    138.48    6.9240     4.9  \n",
       "981  19:24:00  电子钱包     54.45    2.7225     7.9  \n",
       "982  19:25:00  电子钱包    580.00   29.0000     9.2  \n",
       "983  19:26:00  电子钱包     50.62    2.5310     7.2  \n",
       "984  19:29:00   信用卡    448.56   22.4280     7.3  \n",
       "985  19:35:00   信用卡    707.44   35.3720     4.3  \n",
       "986  19:41:00    现金    882.81  144.1405     9.3  \n",
       "987  19:42:00  电子钱包    152.80    7.6400     6.5  \n",
       "988  19:44:00   信用卡     28.78    1.4390     7.2  \n",
       "989  19:48:00   信用卡    369.80   18.4900     7.0  \n",
       "990  19:49:00   信用卡    408.73   20.4365     8.2  \n",
       "991  19:51:00    现金    435.60   21.7800     6.9  \n",
       "992  19:53:00  电子钱包    769.20   38.4600     5.6  \n",
       "993  19:53:00  电子钱包    390.96  119.5480     6.4  \n",
       "994  19:54:00  电子钱包    448.60   22.4300     8.2  \n",
       "995  19:57:00   信用卡    440.20  122.0100     9.6  \n",
       "996  20:08:00   信用卡    267.78   13.3890     5.1  \n",
       "997  20:19:00    现金    372.78   18.6390     7.4  \n",
       "998  20:26:00  电子钱包    108.16    5.4080     6.9  \n",
       "999  20:34:00    现金    552.78  127.6390     8.3  \n",
       "\n",
       "[1000 rows x 14 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_sale = pd.read_excel(r'D:pandas库/dataset/超市销售数据.xlsx',)\n",
    "data_sale"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 方法有1：用时间对象"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1加工时间对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_sale['时间对象'] = pd.to_datetime(data_sale['购买日期'].astype('str')+' '+data_sale['时间'].astype('str'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2.提取每个时间对象的小时数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>发票编号</th>\n",
       "      <th>分店</th>\n",
       "      <th>城市</th>\n",
       "      <th>顾客类型</th>\n",
       "      <th>性别</th>\n",
       "      <th>商品类别</th>\n",
       "      <th>商品单价（美元）</th>\n",
       "      <th>购买数量（件）</th>\n",
       "      <th>购买日期</th>\n",
       "      <th>时间</th>\n",
       "      <th>支付方式</th>\n",
       "      <th>支付费用（美元）</th>\n",
       "      <th>收益（美元）</th>\n",
       "      <th>购物体验评分</th>\n",
       "      <th>时间对象</th>\n",
       "      <th>小时数</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>426-39-2418</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>61.41</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-14</td>\n",
       "      <td>10:02:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>429.87</td>\n",
       "      <td>21.4935</td>\n",
       "      <td>9.8</td>\n",
       "      <td>2020-01-14 10:02:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>527-09-6272</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>28.45</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-21</td>\n",
       "      <td>10:17:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>142.25</td>\n",
       "      <td>7.1125</td>\n",
       "      <td>9.1</td>\n",
       "      <td>2020-03-21 10:17:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>761-49-0439</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>12.10</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-01-19</td>\n",
       "      <td>10:17:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>96.80</td>\n",
       "      <td>4.8400</td>\n",
       "      <td>8.6</td>\n",
       "      <td>2020-01-19 10:17:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>421-95-9805</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>28.96</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-07</td>\n",
       "      <td>10:18:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>28.96</td>\n",
       "      <td>1.4480</td>\n",
       "      <td>6.2</td>\n",
       "      <td>2020-02-07 10:18:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>811-03-8790</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>45.48</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-01</td>\n",
       "      <td>10:22:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>454.80</td>\n",
       "      <td>22.7400</td>\n",
       "      <td>4.8</td>\n",
       "      <td>2020-03-01 10:22:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>745-71-3520</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>25.22</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-04</td>\n",
       "      <td>10:23:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>176.54</td>\n",
       "      <td>8.8270</td>\n",
       "      <td>8.2</td>\n",
       "      <td>2020-02-04 10:23:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>250-81-7186</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>99.69</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-27</td>\n",
       "      <td>10:23:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>99.69</td>\n",
       "      <td>4.9845</td>\n",
       "      <td>8.0</td>\n",
       "      <td>2020-02-27 10:23:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>399-69-4630</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>22.21</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-07</td>\n",
       "      <td>10:23:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>133.26</td>\n",
       "      <td>6.6630</td>\n",
       "      <td>8.6</td>\n",
       "      <td>2020-03-07 10:23:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>365-64-0515</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>46.95</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-02-12</td>\n",
       "      <td>10:25:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>234.75</td>\n",
       "      <td>11.7375</td>\n",
       "      <td>7.1</td>\n",
       "      <td>2020-02-12 10:25:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>213-32-1216</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>66.06</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-23</td>\n",
       "      <td>10:28:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>396.36</td>\n",
       "      <td>19.8180</td>\n",
       "      <td>7.3</td>\n",
       "      <td>2020-01-23 10:28:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>226-31-3081</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>15.28</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-08</td>\n",
       "      <td>10:29:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>76.40</td>\n",
       "      <td>3.8200</td>\n",
       "      <td>9.6</td>\n",
       "      <td>2020-03-08 10:29:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>734-91-1155</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>45.71</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-03-26</td>\n",
       "      <td>10:34:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>137.13</td>\n",
       "      <td>6.8565</td>\n",
       "      <td>7.7</td>\n",
       "      <td>2020-03-26 10:34:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>438-23-1242</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>75.88</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>10:38:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>531.16</td>\n",
       "      <td>16.5580</td>\n",
       "      <td>8.9</td>\n",
       "      <td>2020-01-24 10:38:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>512-98-1403</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>26.48</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-03-21</td>\n",
       "      <td>10:40:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>79.44</td>\n",
       "      <td>3.9720</td>\n",
       "      <td>4.7</td>\n",
       "      <td>2020-03-21 10:40:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>366-93-0948</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>66.35</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-01-31</td>\n",
       "      <td>10:46:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>66.35</td>\n",
       "      <td>3.3175</td>\n",
       "      <td>9.7</td>\n",
       "      <td>2020-01-31 10:46:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>466-61-5506</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>90.70</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-02-26</td>\n",
       "      <td>10:52:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>544.20</td>\n",
       "      <td>27.2100</td>\n",
       "      <td>5.3</td>\n",
       "      <td>2020-02-26 10:52:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>778-34-2523</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>48.62</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>10:57:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>388.96</td>\n",
       "      <td>19.4480</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2020-01-24 10:57:00</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>226-34-0034</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>13.78</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-01-10</td>\n",
       "      <td>11:10:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>55.12</td>\n",
       "      <td>2.7560</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2020-01-10 11:10:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>831-81-6575</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>75.59</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-23</td>\n",
       "      <td>11:12:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>680.31</td>\n",
       "      <td>14.0155</td>\n",
       "      <td>8.0</td>\n",
       "      <td>2020-02-23 11:12:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>636-48-8204</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>34.56</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-02-17</td>\n",
       "      <td>11:15:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>172.80</td>\n",
       "      <td>8.6400</td>\n",
       "      <td>9.9</td>\n",
       "      <td>2020-02-17 11:15:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>233-34-0817</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>98.84</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-15</td>\n",
       "      <td>11:21:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>98.84</td>\n",
       "      <td>4.9420</td>\n",
       "      <td>8.4</td>\n",
       "      <td>2020-02-15 11:21:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>300-71-4605</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>86.04</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-02-25</td>\n",
       "      <td>11:24:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>430.20</td>\n",
       "      <td>21.5100</td>\n",
       "      <td>4.8</td>\n",
       "      <td>2020-02-25 11:24:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>575-67-1508</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>38.60</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-01-29</td>\n",
       "      <td>11:26:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>38.60</td>\n",
       "      <td>1.9300</td>\n",
       "      <td>6.7</td>\n",
       "      <td>2020-01-29 11:26:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>551-21-3069</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>23.07</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-01</td>\n",
       "      <td>11:27:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>207.63</td>\n",
       "      <td>10.3815</td>\n",
       "      <td>4.9</td>\n",
       "      <td>2020-02-01 11:27:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>831-07-6050</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>32.71</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-19</td>\n",
       "      <td>11:30:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>163.55</td>\n",
       "      <td>8.1775</td>\n",
       "      <td>9.9</td>\n",
       "      <td>2020-03-19 11:30:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>804-38-3935</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>93.78</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-01-30</td>\n",
       "      <td>11:32:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>281.34</td>\n",
       "      <td>14.0670</td>\n",
       "      <td>5.9</td>\n",
       "      <td>2020-01-30 11:32:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>886-77-9084</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>71.89</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-02-19</td>\n",
       "      <td>11:33:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>575.12</td>\n",
       "      <td>18.7560</td>\n",
       "      <td>5.5</td>\n",
       "      <td>2020-02-19 11:33:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>603-07-0961</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>74.79</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-01-10</td>\n",
       "      <td>11:34:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>373.95</td>\n",
       "      <td>18.6975</td>\n",
       "      <td>4.9</td>\n",
       "      <td>2020-01-10 11:34:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>652-49-6720</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>60.95</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-18</td>\n",
       "      <td>11:40:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>60.95</td>\n",
       "      <td>3.0475</td>\n",
       "      <td>5.9</td>\n",
       "      <td>2020-02-18 11:40:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>189-40-5216</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>96.37</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-09</td>\n",
       "      <td>11:40:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>674.59</td>\n",
       "      <td>23.7295</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2020-01-09 11:40:00</td>\n",
       "      <td>11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>970</th>\n",
       "      <td>743-88-1662</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>95.49</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-22</td>\n",
       "      <td>18:17:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>668.43</td>\n",
       "      <td>33.4215</td>\n",
       "      <td>8.7</td>\n",
       "      <td>2020-02-22 18:17:00</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>971</th>\n",
       "      <td>560-30-5617</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>24.77</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-24</td>\n",
       "      <td>18:27:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>123.85</td>\n",
       "      <td>6.1925</td>\n",
       "      <td>8.5</td>\n",
       "      <td>2020-03-24 18:27:00</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>972</th>\n",
       "      <td>554-53-3790</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>37.02</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-22</td>\n",
       "      <td>18:33:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>222.12</td>\n",
       "      <td>11.1060</td>\n",
       "      <td>4.5</td>\n",
       "      <td>2020-03-22 18:33:00</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>973</th>\n",
       "      <td>695-51-0018</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>34.84</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-02-10</td>\n",
       "      <td>18:36:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>139.36</td>\n",
       "      <td>6.9680</td>\n",
       "      <td>7.4</td>\n",
       "      <td>2020-02-10 18:36:00</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>974</th>\n",
       "      <td>618-34-8551</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>93.18</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-01-16</td>\n",
       "      <td>18:41:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>186.36</td>\n",
       "      <td>9.3180</td>\n",
       "      <td>8.5</td>\n",
       "      <td>2020-01-16 18:41:00</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>975</th>\n",
       "      <td>696-90-2548</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>25.84</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-03-10</td>\n",
       "      <td>18:55:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>77.52</td>\n",
       "      <td>3.8760</td>\n",
       "      <td>6.6</td>\n",
       "      <td>2020-03-10 18:55:00</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>976</th>\n",
       "      <td>751-69-0068</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>99.24</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-03-19</td>\n",
       "      <td>19:09:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>893.16</td>\n",
       "      <td>44.6580</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2020-03-19 19:09:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>977</th>\n",
       "      <td>123-35-4896</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>46.66</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-17</td>\n",
       "      <td>19:11:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>419.94</td>\n",
       "      <td>20.9970</td>\n",
       "      <td>5.3</td>\n",
       "      <td>2020-02-17 19:11:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>978</th>\n",
       "      <td>129-29-8530</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>62.62</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-10</td>\n",
       "      <td>19:15:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>313.10</td>\n",
       "      <td>15.6550</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2020-03-10 19:15:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>979</th>\n",
       "      <td>423-57-2993</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>93.39</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-27</td>\n",
       "      <td>19:18:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>560.34</td>\n",
       "      <td>28.0170</td>\n",
       "      <td>10.0</td>\n",
       "      <td>2020-03-27 19:18:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>980</th>\n",
       "      <td>510-79-0415</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>23.08</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>19:20:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>138.48</td>\n",
       "      <td>6.9240</td>\n",
       "      <td>4.9</td>\n",
       "      <td>2020-01-24 19:20:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>981</th>\n",
       "      <td>154-74-7179</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>54.45</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-26</td>\n",
       "      <td>19:24:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>54.45</td>\n",
       "      <td>2.7225</td>\n",
       "      <td>7.9</td>\n",
       "      <td>2020-02-26 19:24:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>982</th>\n",
       "      <td>575-30-8091</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>72.50</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-03-16</td>\n",
       "      <td>19:25:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>580.00</td>\n",
       "      <td>29.0000</td>\n",
       "      <td>9.2</td>\n",
       "      <td>2020-03-16 19:25:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>983</th>\n",
       "      <td>825-94-5922</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>25.31</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-03-02</td>\n",
       "      <td>19:26:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>50.62</td>\n",
       "      <td>2.5310</td>\n",
       "      <td>7.2</td>\n",
       "      <td>2020-03-02 19:26:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>984</th>\n",
       "      <td>752-23-3760</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>64.08</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-19</td>\n",
       "      <td>19:29:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>448.56</td>\n",
       "      <td>22.4280</td>\n",
       "      <td>7.3</td>\n",
       "      <td>2020-02-19 19:29:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>985</th>\n",
       "      <td>394-30-3170</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>88.43</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-03-22</td>\n",
       "      <td>19:35:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>707.44</td>\n",
       "      <td>35.3720</td>\n",
       "      <td>4.3</td>\n",
       "      <td>2020-03-22 19:35:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>986</th>\n",
       "      <td>827-77-7633</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>98.09</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-17</td>\n",
       "      <td>19:41:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>882.81</td>\n",
       "      <td>144.1405</td>\n",
       "      <td>9.3</td>\n",
       "      <td>2020-02-17 19:41:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>987</th>\n",
       "      <td>423-80-0988</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>76.40</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-01-30</td>\n",
       "      <td>19:42:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>152.80</td>\n",
       "      <td>7.6400</td>\n",
       "      <td>6.5</td>\n",
       "      <td>2020-01-30 19:42:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>988</th>\n",
       "      <td>883-17-4236</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>14.39</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-03-02</td>\n",
       "      <td>19:44:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>28.78</td>\n",
       "      <td>1.4390</td>\n",
       "      <td>7.2</td>\n",
       "      <td>2020-03-02 19:44:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>989</th>\n",
       "      <td>493-65-6248</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>36.98</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-01-01</td>\n",
       "      <td>19:48:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>369.80</td>\n",
       "      <td>18.4900</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2020-01-01 19:48:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>990</th>\n",
       "      <td>503-07-0930</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>58.39</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-23</td>\n",
       "      <td>19:49:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>408.73</td>\n",
       "      <td>20.4365</td>\n",
       "      <td>8.2</td>\n",
       "      <td>2020-02-23 19:49:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>991</th>\n",
       "      <td>327-40-9673</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>72.60</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-13</td>\n",
       "      <td>19:51:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>435.60</td>\n",
       "      <td>21.7800</td>\n",
       "      <td>6.9</td>\n",
       "      <td>2020-01-13 19:51:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>992</th>\n",
       "      <td>880-46-5796</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>76.92</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-17</td>\n",
       "      <td>19:53:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>769.20</td>\n",
       "      <td>38.4600</td>\n",
       "      <td>5.6</td>\n",
       "      <td>2020-03-17 19:53:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>993</th>\n",
       "      <td>276-54-0879</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>97.74</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-03-12</td>\n",
       "      <td>19:53:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>390.96</td>\n",
       "      <td>119.5480</td>\n",
       "      <td>6.4</td>\n",
       "      <td>2020-03-12 19:53:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>994</th>\n",
       "      <td>225-32-0908</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>44.86</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-01-26</td>\n",
       "      <td>19:54:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>448.60</td>\n",
       "      <td>22.4300</td>\n",
       "      <td>8.2</td>\n",
       "      <td>2020-01-26 19:54:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>828-61-5674</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>44.02</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-20</td>\n",
       "      <td>19:57:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>440.20</td>\n",
       "      <td>122.0100</td>\n",
       "      <td>9.6</td>\n",
       "      <td>2020-03-20 19:57:00</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>670-71-7306</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>44.63</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-02</td>\n",
       "      <td>20:08:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>267.78</td>\n",
       "      <td>13.3890</td>\n",
       "      <td>5.1</td>\n",
       "      <td>2020-01-02 20:08:00</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>630-74-5166</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>62.13</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-22</td>\n",
       "      <td>20:19:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>372.78</td>\n",
       "      <td>18.6390</td>\n",
       "      <td>7.4</td>\n",
       "      <td>2020-03-22 20:19:00</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>182-52-7000</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>27.04</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-01-01</td>\n",
       "      <td>20:26:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>108.16</td>\n",
       "      <td>5.4080</td>\n",
       "      <td>6.9</td>\n",
       "      <td>2020-01-01 20:26:00</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>802-70-5316</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>92.13</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-06</td>\n",
       "      <td>20:34:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>552.78</td>\n",
       "      <td>127.6390</td>\n",
       "      <td>8.3</td>\n",
       "      <td>2020-03-06 20:34:00</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 16 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            发票编号   分店   城市  顾客类型 性别   商品类别  商品单价（美元）  购买数量（件）       购买日期  \\\n",
       "0    426-39-2418  分店C  城市C  普通顾客  男   电子配件     61.41        7 2020-01-14   \n",
       "1    527-09-6272  分店A  城市A    会员  女   电子配件     28.45        5 2020-03-21   \n",
       "2    761-49-0439  分店B  城市B    会员  女   电子配件     12.10        8 2020-01-19   \n",
       "3    421-95-9805  分店A  城市A  普通顾客  女   电子配件     28.96        1 2020-02-07   \n",
       "4    811-03-8790  分店A  城市A  普通顾客  女   电子配件     45.48       10 2020-03-01   \n",
       "5    745-71-3520  分店A  城市A    会员  女   电子配件     25.22        7 2020-02-04   \n",
       "6    250-81-7186  分店C  城市C  普通顾客  女   电子配件     99.69        1 2020-02-27   \n",
       "7    399-69-4630  分店C  城市C  普通顾客  男   电子配件     22.21        6 2020-03-07   \n",
       "8    365-64-0515  分店A  城市A  普通顾客  女   电子配件     46.95        5 2020-02-12   \n",
       "9    213-32-1216  分店A  城市A  普通顾客  女   电子配件     66.06        6 2020-01-23   \n",
       "10   226-31-3081  分店C  城市C  普通顾客  女   电子配件     15.28        5 2020-03-08   \n",
       "11   734-91-1155  分店B  城市B  普通顾客  女   电子配件     45.71        3 2020-03-26   \n",
       "12   438-23-1242  分店B  城市B  普通顾客  男   电子配件     75.88        7 2020-01-24   \n",
       "13   512-98-1403  分店A  城市A    会员  女   电子配件     26.48        3 2020-03-21   \n",
       "14   366-93-0948  分店A  城市A    会员  男   电子配件     66.35        1 2020-01-31   \n",
       "15   466-61-5506  分店B  城市B    会员  女   电子配件     90.70        6 2020-02-26   \n",
       "16   778-34-2523  分店A  城市A    会员  女   电子配件     48.62        8 2020-01-24   \n",
       "17   226-34-0034  分店B  城市B  普通顾客  女   电子配件     13.78        4 2020-01-10   \n",
       "18   831-81-6575  分店B  城市B    会员  女   电子配件     75.59        9 2020-02-23   \n",
       "19   636-48-8204  分店A  城市A  普通顾客  男   电子配件     34.56        5 2020-02-17   \n",
       "20   233-34-0817  分店C  城市C    会员  女   电子配件     98.84        1 2020-02-15   \n",
       "21   300-71-4605  分店C  城市C    会员  男   电子配件     86.04        5 2020-02-25   \n",
       "22   575-67-1508  分店A  城市A  普通顾客  男   电子配件     38.60        1 2020-01-29   \n",
       "23   551-21-3069  分店C  城市C  普通顾客  女   电子配件     23.07        9 2020-02-01   \n",
       "24   831-07-6050  分店A  城市A  普通顾客  男   电子配件     32.71        5 2020-03-19   \n",
       "25   804-38-3935  分店A  城市A    会员  男   电子配件     93.78        3 2020-01-30   \n",
       "26   886-77-9084  分店C  城市C  普通顾客  男   电子配件     71.89        8 2020-02-19   \n",
       "27   603-07-0961  分店C  城市C    会员  男   电子配件     74.79        5 2020-01-10   \n",
       "28   652-49-6720  分店C  城市C    会员  女   电子配件     60.95        1 2020-02-18   \n",
       "29   189-40-5216  分店C  城市C  普通顾客  男   电子配件     96.37        7 2020-01-09   \n",
       "..           ...  ...  ...   ... ..    ...       ...      ...        ...   \n",
       "970  743-88-1662  分店C  城市C  普通顾客  男  运动与旅行     95.49        7 2020-02-22   \n",
       "971  560-30-5617  分店B  城市B  普通顾客  女  运动与旅行     24.77        5 2020-03-24   \n",
       "972  554-53-3790  分店B  城市B  普通顾客  男  运动与旅行     37.02        6 2020-03-22   \n",
       "973  695-51-0018  分店B  城市B  普通顾客  女  运动与旅行     34.84        4 2020-02-10   \n",
       "974  618-34-8551  分店A  城市A  普通顾客  女  运动与旅行     93.18        2 2020-01-16   \n",
       "975  696-90-2548  分店A  城市A  普通顾客  男  运动与旅行     25.84        3 2020-03-10   \n",
       "976  751-69-0068  分店C  城市C  普通顾客  男  运动与旅行     99.24        9 2020-03-19   \n",
       "977  123-35-4896  分店C  城市C  普通顾客  女  运动与旅行     46.66        9 2020-02-17   \n",
       "978  129-29-8530  分店A  城市A    会员  男  运动与旅行     62.62        5 2020-03-10   \n",
       "979  423-57-2993  分店B  城市B  普通顾客  男  运动与旅行     93.39        6 2020-03-27   \n",
       "980  510-79-0415  分店B  城市B    会员  女  运动与旅行     23.08        6 2020-01-24   \n",
       "981  154-74-7179  分店B  城市B  普通顾客  男  运动与旅行     54.45        1 2020-02-26   \n",
       "982  575-30-8091  分店A  城市A  普通顾客  男  运动与旅行     72.50        8 2020-03-16   \n",
       "983  825-94-5922  分店B  城市B  普通顾客  男  运动与旅行     25.31        2 2020-03-02   \n",
       "984  752-23-3760  分店B  城市B    会员  女  运动与旅行     64.08        7 2020-02-19   \n",
       "985  394-30-3170  分店B  城市B    会员  女  运动与旅行     88.43        8 2020-03-22   \n",
       "986  827-77-7633  分店A  城市A  普通顾客  男  运动与旅行     98.09        9 2020-02-17   \n",
       "987  423-80-0988  分店C  城市C  普通顾客  男  运动与旅行     76.40        2 2020-01-30   \n",
       "988  883-17-4236  分店C  城市C  普通顾客  女  运动与旅行     14.39        2 2020-03-02   \n",
       "989  493-65-6248  分店C  城市C    会员  女  运动与旅行     36.98       10 2020-01-01   \n",
       "990  503-07-0930  分店C  城市C    会员  男  运动与旅行     58.39        7 2020-02-23   \n",
       "991  327-40-9673  分店B  城市B    会员  男  运动与旅行     72.60        6 2020-01-13   \n",
       "992  880-46-5796  分店A  城市A    会员  男  运动与旅行     76.92       10 2020-03-17   \n",
       "993  276-54-0879  分店B  城市B  普通顾客  男  运动与旅行     97.74        4 2020-03-12   \n",
       "994  225-32-0908  分店C  城市C  普通顾客  女  运动与旅行     44.86       10 2020-01-26   \n",
       "995  828-61-5674  分店A  城市A    会员  男  运动与旅行     44.02       10 2020-03-20   \n",
       "996  670-71-7306  分店B  城市B  普通顾客  男  运动与旅行     44.63        6 2020-01-02   \n",
       "997  630-74-5166  分店A  城市A  普通顾客  男  运动与旅行     62.13        6 2020-03-22   \n",
       "998  182-52-7000  分店A  城市A    会员  女  运动与旅行     27.04        4 2020-01-01   \n",
       "999  802-70-5316  分店A  城市A    会员  女  运动与旅行     92.13        6 2020-03-06   \n",
       "\n",
       "           时间  支付方式  支付费用（美元）    收益（美元）  购物体验评分                时间对象  小时数  \n",
       "0    10:02:00    现金    429.87   21.4935     9.8 2020-01-14 10:02:00   10  \n",
       "1    10:17:00   信用卡    142.25    7.1125     9.1 2020-03-21 10:17:00   10  \n",
       "2    10:17:00  电子钱包     96.80    4.8400     8.6 2020-01-19 10:17:00   10  \n",
       "3    10:18:00   信用卡     28.96    1.4480     6.2 2020-02-07 10:18:00   10  \n",
       "4    10:22:00   信用卡    454.80   22.7400     4.8 2020-03-01 10:22:00   10  \n",
       "5    10:23:00    现金    176.54    8.8270     8.2 2020-02-04 10:23:00   10  \n",
       "6    10:23:00   信用卡     99.69    4.9845     8.0 2020-02-27 10:23:00   10  \n",
       "7    10:23:00   信用卡    133.26    6.6630     8.6 2020-03-07 10:23:00   10  \n",
       "8    10:25:00  电子钱包    234.75   11.7375     7.1 2020-02-12 10:25:00   10  \n",
       "9    10:28:00    现金    396.36   19.8180     7.3 2020-01-23 10:28:00   10  \n",
       "10   10:29:00    现金     76.40    3.8200     9.6 2020-03-08 10:29:00   10  \n",
       "11   10:34:00   信用卡    137.13    6.8565     7.7 2020-03-26 10:34:00   10  \n",
       "12   10:38:00  电子钱包    531.16   16.5580     8.9 2020-01-24 10:38:00   10  \n",
       "13   10:40:00  电子钱包     79.44    3.9720     4.7 2020-03-21 10:40:00   10  \n",
       "14   10:46:00   信用卡     66.35    3.3175     9.7 2020-01-31 10:46:00   10  \n",
       "15   10:52:00    现金    544.20   27.2100     5.3 2020-02-26 10:52:00   10  \n",
       "16   10:57:00    现金    388.96   19.4480     5.0 2020-01-24 10:57:00   10  \n",
       "17   11:10:00  电子钱包     55.12    2.7560     9.0 2020-01-10 11:10:00   11  \n",
       "18   11:12:00    现金    680.31   14.0155     8.0 2020-02-23 11:12:00   11  \n",
       "19   11:15:00  电子钱包    172.80    8.6400     9.9 2020-02-17 11:15:00   11  \n",
       "20   11:21:00    现金     98.84    4.9420     8.4 2020-02-15 11:21:00   11  \n",
       "21   11:24:00  电子钱包    430.20   21.5100     4.8 2020-02-25 11:24:00   11  \n",
       "22   11:26:00  电子钱包     38.60    1.9300     6.7 2020-01-29 11:26:00   11  \n",
       "23   11:27:00    现金    207.63   10.3815     4.9 2020-02-01 11:27:00   11  \n",
       "24   11:30:00   信用卡    163.55    8.1775     9.9 2020-03-19 11:30:00   11  \n",
       "25   11:32:00   信用卡    281.34   14.0670     5.9 2020-01-30 11:32:00   11  \n",
       "26   11:33:00  电子钱包    575.12   18.7560     5.5 2020-02-19 11:33:00   11  \n",
       "27   11:34:00    现金    373.95   18.6975     4.9 2020-01-10 11:34:00   11  \n",
       "28   11:40:00  电子钱包     60.95    3.0475     5.9 2020-02-18 11:40:00   11  \n",
       "29   11:40:00    现金    674.59   23.7295     6.0 2020-01-09 11:40:00   11  \n",
       "..        ...   ...       ...       ...     ...                 ...  ...  \n",
       "970  18:17:00  电子钱包    668.43   33.4215     8.7 2020-02-22 18:17:00   18  \n",
       "971  18:27:00    现金    123.85    6.1925     8.5 2020-03-24 18:27:00   18  \n",
       "972  18:33:00    现金    222.12   11.1060     4.5 2020-03-22 18:33:00   18  \n",
       "973  18:36:00    现金    139.36    6.9680     7.4 2020-02-10 18:36:00   18  \n",
       "974  18:41:00   信用卡    186.36    9.3180     8.5 2020-01-16 18:41:00   18  \n",
       "975  18:55:00  电子钱包     77.52    3.8760     6.6 2020-03-10 18:55:00   18  \n",
       "976  19:09:00  电子钱包    893.16   44.6580     9.0 2020-03-19 19:09:00   19  \n",
       "977  19:11:00  电子钱包    419.94   20.9970     5.3 2020-02-17 19:11:00   19  \n",
       "978  19:15:00  电子钱包    313.10   15.6550     7.0 2020-03-10 19:15:00   19  \n",
       "979  19:18:00  电子钱包    560.34   28.0170    10.0 2020-03-27 19:18:00   19  \n",
       "980  19:20:00  电子钱包    138.48    6.9240     4.9 2020-01-24 19:20:00   19  \n",
       "981  19:24:00  电子钱包     54.45    2.7225     7.9 2020-02-26 19:24:00   19  \n",
       "982  19:25:00  电子钱包    580.00   29.0000     9.2 2020-03-16 19:25:00   19  \n",
       "983  19:26:00  电子钱包     50.62    2.5310     7.2 2020-03-02 19:26:00   19  \n",
       "984  19:29:00   信用卡    448.56   22.4280     7.3 2020-02-19 19:29:00   19  \n",
       "985  19:35:00   信用卡    707.44   35.3720     4.3 2020-03-22 19:35:00   19  \n",
       "986  19:41:00    现金    882.81  144.1405     9.3 2020-02-17 19:41:00   19  \n",
       "987  19:42:00  电子钱包    152.80    7.6400     6.5 2020-01-30 19:42:00   19  \n",
       "988  19:44:00   信用卡     28.78    1.4390     7.2 2020-03-02 19:44:00   19  \n",
       "989  19:48:00   信用卡    369.80   18.4900     7.0 2020-01-01 19:48:00   19  \n",
       "990  19:49:00   信用卡    408.73   20.4365     8.2 2020-02-23 19:49:00   19  \n",
       "991  19:51:00    现金    435.60   21.7800     6.9 2020-01-13 19:51:00   19  \n",
       "992  19:53:00  电子钱包    769.20   38.4600     5.6 2020-03-17 19:53:00   19  \n",
       "993  19:53:00  电子钱包    390.96  119.5480     6.4 2020-03-12 19:53:00   19  \n",
       "994  19:54:00  电子钱包    448.60   22.4300     8.2 2020-01-26 19:54:00   19  \n",
       "995  19:57:00   信用卡    440.20  122.0100     9.6 2020-03-20 19:57:00   19  \n",
       "996  20:08:00   信用卡    267.78   13.3890     5.1 2020-01-02 20:08:00   20  \n",
       "997  20:19:00    现金    372.78   18.6390     7.4 2020-03-22 20:19:00   20  \n",
       "998  20:26:00  电子钱包    108.16    5.4080     6.9 2020-01-01 20:26:00   20  \n",
       "999  20:34:00    现金    552.78  127.6390     8.3 2020-03-06 20:34:00   20  \n",
       "\n",
       "[1000 rows x 16 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_sale['小时数'] = data_sale['时间对象'].agg(lambda x:x.hour)\n",
    "data_sale"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3.统计商品销量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "小时数\n",
       "10    525\n",
       "11    513\n",
       "12    501\n",
       "13    585\n",
       "14    495\n",
       "15    530\n",
       "16    420\n",
       "17    415\n",
       "18    475\n",
       "19    649\n",
       "20    402\n",
       "Name: 购买数量（件）, dtype: int64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_sale.groupby(by='小时数')['购买数量（件）'].sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 方法二：用字符串截取方法"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.加工小时数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "data_sale['小时数2'] = data_sale['时间'].astype('str').agg(lambda x:int(x[:2]))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2后面的相同"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 案例3：统计超市中用户的不同支付方式支付费用的差异\n",
    "分组聚合中的agg方法可以同时调用多个聚合函数\n",
    "\n",
    "调用的语法：data.groupby（by=分组变量）[聚合变量].agg(函数1,函数2,...)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mean</th>\n",
       "      <th>amax</th>\n",
       "      <th>sum</th>\n",
       "      <th>len</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>支付方式</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>信用卡</th>\n",
       "      <td>308.580836</td>\n",
       "      <td>993.0</td>\n",
       "      <td>95968.64</td>\n",
       "      <td>311.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>现金</th>\n",
       "      <td>310.649419</td>\n",
       "      <td>955.8</td>\n",
       "      <td>106863.40</td>\n",
       "      <td>344.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子钱包</th>\n",
       "      <td>303.638667</td>\n",
       "      <td>985.2</td>\n",
       "      <td>104755.34</td>\n",
       "      <td>345.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            mean   amax        sum    len\n",
       "支付方式                                     \n",
       "信用卡   308.580836  993.0   95968.64  311.0\n",
       "现金    310.649419  955.8  106863.40  344.0\n",
       "电子钱包  303.638667  985.2  104755.34  345.0"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "data_sale.groupby(by='支付方式')['支付费用（美元）'].agg([np.mean,np.max,np.sum,len])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 指定多个聚合变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"4\" halign=\"left\">支付费用（美元）</th>\n",
       "      <th colspan=\"4\" halign=\"left\">收益（美元）</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>mean</th>\n",
       "      <th>amax</th>\n",
       "      <th>sum</th>\n",
       "      <th>len</th>\n",
       "      <th>mean</th>\n",
       "      <th>amax</th>\n",
       "      <th>sum</th>\n",
       "      <th>len</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>支付方式</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>信用卡</th>\n",
       "      <td>308.580836</td>\n",
       "      <td>993.0</td>\n",
       "      <td>95968.64</td>\n",
       "      <td>311.0</td>\n",
       "      <td>25.750585</td>\n",
       "      <td>236.3555</td>\n",
       "      <td>8008.432</td>\n",
       "      <td>311.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>现金</th>\n",
       "      <td>310.649419</td>\n",
       "      <td>955.8</td>\n",
       "      <td>106863.40</td>\n",
       "      <td>344.0</td>\n",
       "      <td>26.259215</td>\n",
       "      <td>437.3000</td>\n",
       "      <td>9033.170</td>\n",
       "      <td>344.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子钱包</th>\n",
       "      <td>303.638667</td>\n",
       "      <td>985.2</td>\n",
       "      <td>104755.34</td>\n",
       "      <td>345.0</td>\n",
       "      <td>26.671788</td>\n",
       "      <td>343.9350</td>\n",
       "      <td>9201.767</td>\n",
       "      <td>345.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        支付费用（美元）                              收益（美元）                      \\\n",
       "            mean   amax        sum    len       mean      amax       sum   \n",
       "支付方式                                                                       \n",
       "信用卡   308.580836  993.0   95968.64  311.0  25.750585  236.3555  8008.432   \n",
       "现金    310.649419  955.8  106863.40  344.0  26.259215  437.3000  9033.170   \n",
       "电子钱包  303.638667  985.2  104755.34  345.0  26.671788  343.9350  9201.767   \n",
       "\n",
       "             \n",
       "        len  \n",
       "支付方式         \n",
       "信用卡   311.0  \n",
       "现金    344.0  \n",
       "电子钱包  345.0  "
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_sale.groupby(by='支付方式')['支付费用（美元）','收益（美元）'].agg([np.mean,np.max,np.sum,len])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
